/* eslint-disable @typescript-eslint/no-var-requires */
import { Body, Controller, Request, Post, Get, Query } from '@nestjs/common';
import { PayService } from '../services';
import { OrderRefundDto } from '../dto/orderRefund.dto';
import { PayDto } from '../dto/pay.dto';
import { User } from '@/modules/User/types';
import { Public } from '@/modules/core/decorators/publicGuards';
@Controller('pay')
export class PayController {
  constructor(private payService: PayService) {}
  @Post('pcpay')
  async pay(@Body() body: PayDto) {
    return await this.payService.pay(body);
  }

  @Get('order_query')
  async query(@Request() req, @Query() query: any) {
    return await this.payService.orderQuery(req.user as User, query.orderId);
  }
  @Post('order_refund')
  async orderRefund(@Body() body: OrderRefundDto) {
    return await this.payService.orderRefund(body);
  }
  @Get('order_refund_query')
  async mutilUpdate(@Query() query: any) {
    return await this.payService.orderRefundQuery(query);
  }

  @Public()
  @Post('notify')
  async notify(@Body() body: any) {
    return await this.payService.notify(body);
  }

  @Public()
  @Get('notify')
  async notify2(@Body() body: any) {
    return await this.payService.notify2(body);
  }
}
